<h1 id="title" class="title">后台登录</h1>

<nb-alert *ngIf="showMessages.error && errors?.length && !submitted" outline="danger" role="alert">
  <p class="alert-title"><b>Oh snap!</b></p>
  <ul class="alert-message-list">
    <li *ngFor="let error of errors" class="alert-message">{{ error }}</li>
  </ul>
</nb-alert>

<nb-alert *ngIf="showMessages.success && messages?.length && !submitted" outline="success" role="alert">
  <p class="alert-title"><b>Hooray!</b></p>
  <ul class="alert-message-list">
    <li *ngFor="let message of messages" class="alert-message">{{ message }}</li>
  </ul>
</nb-alert>

<form (ngSubmit)="login()" aria-labelledby="title">

  <div class="form-control-group">
    <label class="label" for="input-email">用户名:</label>
    <input nbInput
           fullWidth
           [(ngModel)]="user.email"
           name="email"
           id="input-email"
           autofocus
           [status]="'success'">
  </div>

  <div class="form-control-group">
    <label class="label" for="input-password">密码:</label>
    <input nbInput
           fullWidth
           [(ngModel)]="user.password"
           name="password"
           type="password"
           id="input-password"
           [status]="'success'">
  </div>

  <div class="form-control-group accept-group">

    <nb-checkbox name="rememberMe" [(ngModel)]="isAdmin">管理员登录</nb-checkbox>
  </div>

<!--  <div class="form-control-group accept-group">-->

<!--    <nb-checkbox name="rememberMe" [(ngModel)]="user.rememberMe" *ngIf="rememberMe">Remember me</nb-checkbox>-->
<!--  </div>-->

  <button nbButton
          fullWidth
          status="primary"
          [disabled]="submitted"
          [class.btn-pulse]="submitted">
    登录
  </button>
</form>

